﻿<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" CodeBehind="img_resizer_settings.aspx.cs"
    Inherits="WeMakeSP.ImageResizer.ApplicationPages.ImageResizerSettings, WeMakeSP.ImageResizer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=92b19f52e3b985bd" %>

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" Src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" Src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" Src="/_controltemplates/InputFormControl.ascx" %>
<asp:Content ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    <SharePoint:EncodedLiteral runat="server" Text="<%$Resources: image_resizer,ir_settings_page_head%>"
        EncodeMethod='HtmlEncode' />
</asp:Content>
<asp:Content ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    <SharePoint:EncodedLiteral runat="server" Text="<%$Resources: image_resizer,ir_settings_page_title%>"
        EncodeMethod='HtmlEncode' />
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="PlaceHolderPageDescription" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderPageDescriptionRowAttr"
    runat="server">
    style="display:none;"
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderPageDescriptionRowAttr2"
    runat="server">
    style="display:none;"
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderPageImage" runat="server" />
<asp:Content ID="Content6" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <script type="text/javascript">

        function SetScheduleVisibility(value) {
            switch (value) {
                case "Immediate":
                    $("#" + schedulePanelId).hide();
                    $("#" + immediatePanelId).show();
                    break;
                case "Daily":
                    $("#" + immediatePanelId).hide();
                    $("#" + schedulePanelId).show();
                    break;
                case "Weekly":
                    $("#" + immediatePanelId).hide();
                    $("#" + schedulePanelId).show();
                    break;
                case "Monthly":
                    $("#" + immediatePanelId).hide();
                    $("#" + schedulePanelId).show();
                    break;
                default:
                    break;
            }
        }

        var immediatePanelId = "<%= immediateSettingsPanel.ClientID %>";
        var schedulePanelId = "<%= scheduleSettingsPanel.ClientID %>";
        var scheduleRadionButtonListId = "<%= scheduleRadioButtonList.ClientID %>";

        $(document).ready(function() {

            var initialState =
            $("#" + scheduleRadionButtonListId).find("input:checked").val();

            SetScheduleVisibility(initialState);

            $("#" + scheduleRadionButtonListId).click(function() {
                var checkedValue = $(this).find("input:checked").val();
                SetScheduleVisibility(checkedValue);
            });
        });
    </script>

    <!-- Enable Section -->
    <wssuc:inputformsection id="enableConfigurationSection" title="<%$Resources:image_resizer,ir_enable_settings_title%>"
        description="<%$Resources:image_resizer,ir_enable_settings_description%>" runat="server">
        <template_inputformcontrols>
		<wssuc:InputFormControl runat="server" id="enableConfigurationInputFormControl">
			<Template_Control>
				<TABLE border="0" width="100%" cellspacing="0" cellpadding="2">
					<TR>
						<TD class="ms-authoringcontrols" valign="top" align="center" width="50">
							<asp:CheckBox ID="enableConfigurationCheckBox" Checked="false" runat="server" />
						</TD>
						<TD class="ms-authoringcontrols" width="10"></TD>
						<TD nowrap class="ms-authoringcontrols" width="100%">
							<Label for=<%SPHttpUtility.AddQuote(SPHttpUtility.NoEncode(enableConfigurationCheckBox.ClientID),Response.Output);%>><SharePoint:EncodedLiteral ID="EncodedLiteral4" runat="server" text="<%$Resources:image_resizer,ir_enable_settings%>" EncodeMethod='HtmlEncode'/></Label>
						</TD>
					</TR>
				</TABLE>
			</Template_Control>
		</wssuc:InputFormControl>
	</template_inputformcontrols>
    </wssuc:inputformsection>
    <!-- Max Size Section --> 
<wssuc:inputformsection id="maxSizeSection" title="<%$Resources:image_resizer,ir_max_size_title%>" description="<%$Resources:image_resizer,ir_max_size_description%>"
        runat="server">
        <template_inputformcontrols>
		<wssuc:InputFormControl runat="server" id="maxSizeInputFormControl">
			<Template_Control>
				<TABLE border="0" width="100%" cellspacing="0" cellpadding="2">
					<TR>
						<TD class="ms-authoringcontrols" valign="top" align="left">
						    <table class="ms-authoringcontrols" border="0">
						        <tr>
						            <td>
						                <asp:TextBox ID="maxWidthTextBox" Width="40px" runat="server" MaxLength="4" />
						                <asp:Label Text="px" runat="server" />
						            </td>
						            <td><asp:Label ID="Literal1" Text=" X " runat="server" /></td>
						            <td>
						                <asp:TextBox ID="maxHeightTextBox" Width="40px" MaxLength="4" runat="server" />
						                <asp:Label Text="px" runat="server" />
						            </td>
						            
						        </tr>
						    </table>
						</TD>
					</TR>
				</TABLE>
				<SharePoint:InputFormRangeValidator 
			    id="maxWidthRangeValidator" 
			    ControlToValidate="maxWidthTextBox"
			    runat="server" ErrorMessage="<%$Resources:image_resizer,ir_width_error%>" 
			    MinimumValue="1" MaximumValue="9999" />
			    <SharePoint:InputFormRangeValidator 
			    id="maxHeightRangeValidator" 
			    ControlToValidate="maxHeightTextBox"
			    runat="server" ErrorMessage="<%$Resources:image_resizer,ir_height_error%>" 
			    MinimumValue="1" MaximumValue="9999" />
			</Template_Control>
		</wssuc:InputFormControl>
	</template_inputformcontrols>
    </wssuc:inputformsection>
    <!-- Mode Section -->
    <wssuc:inputformsection id="modeSection" title="<%$Resources:image_resizer,ir_mode_title%>" description="<%$Resources:image_resizer,ir_mode_description%>" runat="server">
        <template_inputformcontrols>
		<wssuc:InputFormControl runat="server" id="modeInputFormControl">
			<Template_Control>
				<TABLE class="ms-authoringcontrols" border="0" width="100%" cellspacing="0" cellpadding="2">
					<TR>
						<TD class="ms-authoringcontrols" valign="top" align="left">
						    <asp:RadioButtonList ID="modeRadionButtonList" runat="server" CssClass="ms-authoringcontrols" RepeatDirection="Horizontal">
						        <asp:ListItem Text="<%$Resources:image_resizer,ir_fixed_size%>" Value="Resize"></asp:ListItem>
						        <asp:ListItem Text="<%$Resources:image_resizer,ir_resize_proportional%>" Value="ResizeProportional"></asp:ListItem>
						    </asp:RadioButtonList>
						</TD>
					</TR>
				</TABLE>
			</Template_Control>
		</wssuc:InputFormControl>
	</template_inputformcontrols>
    </wssuc:inputformsection>
    <!-- Schedule Section -->
    <wssuc:inputformsection id="scheduleSection" title="<%$Resources:image_resizer,ir_schedule_title%>" description="<%$Resources:image_resizer,ir_schedule_description%>"
        runat="server">
        <template_inputformcontrols>
		<wssuc:InputFormControl runat="server" id="scheduleInputFormControl">
			<Template_Control>
			    <table class="ms-authoringcontrols" cellspacing="0" cellpadding="2" border="0" width="100%">
			        <tr>
			            <td style="width:30%;max-width:100px;">
			                <asp:RadioButtonList ID="scheduleRadioButtonList" runat="server" CssClass="ms-authoringcontrols">
			                    <asp:ListItem ID="immediateRadioButton" Text="<%$Resources:image_resizer,ir_immediate%>" runat="server" />
			                    <asp:ListItem ID="dailyRadioButton" Text="<%$Resources:image_resizer,ir_daily%>" runat="server" />
			                    <asp:ListItem ID="weeklyRadioButton" Text="<%$Resources:image_resizer,ir_weekly%>" runat="server" />
			                    <asp:ListItem ID="monthlyRadioButton" Text="<%$Resources:image_resizer,ir_monthly%>" runat="server" />
			                </asp:RadioButtonList>
			            </td>
			            <td>
			                <asp:Panel ID="immediateSettingsPanel" runat="server" HorizontalAlign="Left">
			                    <asp:Label ID="Label4" Text="<%$Resources:image_resizer,ir_start_resizing_after%>" runat="server" />
			                    <asp:TextBox ID="immediateHoursDelay" Width="20" MaxLength="2" runat="server"/>
			                    <asp:Label ID="Label5" Text="H" runat="server" />
			                    <asp:TextBox ID="immediateMinutesDelay" Width="20" MaxLength="2" runat="server"/>
			                    <asp:Label ID="Label6" Text="m" runat="server" />
			                </asp:Panel>
			                <asp:Panel ID="scheduleSettingsPanel" runat="server" HorizontalAlign="Left">
			                    <asp:Label ID="Label1" Text="<%$Resources:image_resizer,ir_start_resizing_image_at%>" runat="server" />
			                    <asp:TextBox ID="scheduleHourStartTimeTextBox" Width="20" MaxLength="2" runat="server"/>
			                    <asp:Label ID="Label2" Text="H" runat="server" />
			                    <asp:TextBox ID="scheduleMinutesStartTimeTextBox" runat="server" Width="20" MaxLength="2"/>
			                    <asp:Label ID="Label3" Text="m" runat="server" />
			                </asp:Panel>
			            </td>
			        </tr>
			    </table>
			<SharePoint:InputFormRangeValidator 
			    id="immediateHourRangeValidator" 
			    ControlToValidate="immediateHoursDelay"
			    runat="server" ErrorMessage="<%$Resources:image_resizer,ir_hours_validation%>" 
			    MinimumValue="0" MaximumValue="99" />
			<SharePoint:InputFormRangeValidator 
			    id="immediateMinuteRangeValidator" 
			    ControlToValidate="immediateMinutesDelay"
			    runat="server" ErrorMessage="<%$Resources:image_resizer,ir_minutes_validation%>" 
			    MinimumValue="0" MaximumValue="59" />
			<SharePoint:InputFormRangeValidator 
			    id="scheduleHourStartTimeRangeValidator" 
			    ControlToValidate="scheduleHourStartTimeTextBox"
			    runat="server" ErrorMessage="<%$Resources:image_resizer,ir_hour_of_day_validation%>" 
			    MinimumValue="0" MaximumValue="23" />
			<SharePoint:InputFormRangeValidator 
			    id="scheduleMinutesStartTimeRangeValidator" 
			    ControlToValidate="scheduleMinutesStartTimeTextBox"
			    runat="server" ErrorMessage="<%$Resources:image_resizer,ir_minutes_validation%>" 
			    MinimumValue="0" MaximumValue="59" />
			</Template_Control>
			</wssuc:InputFormControl>
	    </template_inputformcontrols>
    </wssuc:inputformsection>
    <wssuc:ButtonSection runat="server">
        <template_buttons>
					<INPUT type=submit class="ms-ButtonHeightWidth" value="<%$Resources:wss,themeweb_apply%>" id=submit name=submit OnServerClick="SubmitClickEventHandler" ACCESSKEY="S" runat="server" causesvalidation="true"/>
		</template_buttons>
    </wssuc:ButtonSection>
    
</asp:Content>
